import http from '@/utils/Httprequest';

// 菜单
export let getMenuApi = () => {
	return http({
		url : '/system/getMenu',
		method : 'GET'
	});
};

// 权限
export let getPermiApi = () => {
	return http({
		url : '/system/permissions',
		method : 'GET'
	});
};

// 登录
export let loginApi = (data) => {
	return http({
		url : '/system/user/login',
		data
	});
};

// 用户列表
export let getUserListApi = (params) => {
	return http({
		url : '/system/user/list',
		method : 'GET',
		params
	});
};

// 查询用户角色/岗位
export let getRolesOrPostsApi = () => {
	return http({
		url : '/system/rolesOrPosts',
		method : 'GET'
	});
};
// 列表新增
export let createUserApi = (data) => {
	return http({
		url : '/system/user',
		data
	});
};

// 用户修改
export let updateUserApi = (data) => {
	return http({
		url : '/system/user',
		method : 'PUT',
		data
	});
};

// 用户删除
export let deleteUserApi = (data) => {
	return http({
		url : '/system/user',
		method : 'DELETE',
		data
	});
};

// 部门列表
export let getDeptListApi = (params) => {
	return http({
		url : '/system/dept/list',
		method : 'GET',
		params
	});
};

// 部门新增
export let createDeptApi = (data) => {
	return http({
		url : '/system/dept',
		data
	});
};

// 部门修改
export let updateDeptApi = (data) => {
	return http({
		url : '/system/dept',
		method : 'PUT',
		data
	});
};

// 部门删除
export let deleteDeptApi = (id) => {
	return http({
		url : '/system/dept/' + id,
		method : 'DELETE'
	});
};

// 岗位列表
export let getPostListApi = (params) => {
	return http({
		url : '/system/post/list',
		method : 'GET',
		params
	});
};

// 岗位新增
export let createPostApi = (data) => {
	return http({
		url : '/system/post',
		data
	});
};

// 岗位修改
export let updatePostApi = (data) => {
	return http({
		url : '/system/post',
		method : 'PUT',
		data
	});
};

// 岗位删除
export let deletePostApi = (data) => {
	return http({
		url : '/system/post',
		method : 'DELETE',
		data
	});
};

// 字典列表
export let getDictListApi = (params) => {
	return http({
		url : '/system/dict/type/list',
		method : 'GET',
		params
	});
};

// 字典新增
export let createDictApi = (data) => {
	return http({
		url : '/system/dict/type',
		data
	});
};

// 字典修改
export let updateDictApi = (data) => {
	return http({
		url : '/system/dict/type',
		method : 'PUT',
		data
	});
};

// 字典删除
export let deleteDictApi = (data) => {
	return http({
		url : '/system/dict/type',
		method : 'DELETE',
		data
	});
};

// 字典数据列表
export let getDictDataListApi = (params) => {
	return http({
		url : '/system/dict/type/data/list',
		method : 'GET',
		params
	});
};

// 字典新增
export let createDictDataApi = (data) => {
	return http({
		url : '/system/dict/data/type',
		data
	});
};

// 字典修改
export let updateDictDataApi = (data) => {
	return http({
		url : '/system/dict/data/type',
		method : 'PUT',
		data
	});
};

// 字典删除
export let deleteDictDataApi = (data) => {
	return http({
		url : '/system/dict/data/type',
		method : 'DELETE',
		data
	});
};

// 菜单数据列表
export let getMenuListApi = (params) => {
	return http({
		url : '/system/menu/list',
		method : 'GET',
		params
	});
};

// 菜单新增
export let createMenuApi = (data) => {
	return http({
		url : '/system/menu',
		data
	});
};

// 菜单修改
export let updateMenuApi = (data) => {
	return http({
		url : '/system/menu',
		method : 'PUT',
		data
	});
};

// 菜单删除
export let deleteMenuApi = (data) => {
	return http({
		url : '/system/menu',
		method : 'DELETE',
		data
	});
};

// 菜单数据列表
export let getRoleListApi = (params) => {
	return http({
		url : '/system/role/list',
		method : 'GET',
		params
	});
};

// 菜单新增
export let createRoleApi = (data) => {
	return http({
		url : '/system/role',
		data
	});
};

// 菜单修改
export let updateRoleApi = (data) => {
	return http({
		url : '/system/role',
		method : 'PUT',
		data
	});
};

// 菜单删除
export let deleteRoleApi = (data) => {
	return http({
		url : '/system/role',
		method : 'DELETE',
		data
	});
};
